import React, {Suspense} from "react";
import Loading from '../components/loading';

const Home = React.lazy(() => import('../pages/home'));

const Layout = React.lazy(() => import('../layouts'));

const HonorRank = React.lazy(() => import('../pages/honorRank'));
const HonorRankRule = React.lazy(() => import('../pages/honorRank/rule'));

const GameKingRank = React.lazy(() => import('../pages/gameKingRank'));
const GameKingRankRule = React.lazy(() => import('../pages/gameKingRank/rule'));
const GameKingRankRecord = React.lazy(() => import('../pages/gameKingRank/record'));

const IntimateRecord = React.lazy(() => import('../pages/fansGroup/intimateRecord'));

const MemberList = React.lazy(() => import('../pages/fansGroup/memberList'));

const Mall = React.lazy(() => import('../pages/mall'));

const PK = React.lazy(() => import('../pages/pk'));

const Transition = React.lazy(() => import('../pages/transition'));

const MidFestival = React.lazy(() => import('../pages/midFestival'));
const MidFestivalRule = React.lazy(() => import('../pages/midFestival/rule'));
const MidFestivalTask = React.lazy(() => import('../pages/midFestival/task'));

const SignUpOpenBox = React.lazy(() => import('../pages/signUp/openBox'));
const SignUpRule = React.lazy(() => import('../pages/signUp/rule'));
const SignUpTask = React.lazy(() => import('../pages/signUp/task'));
const SignUp = React.lazy(() => import('../pages/signUp'));

const routes = [
  {
    path: '/',
    index: true,
    element: <Suspense fallback={<Loading/>}>
      <Home/>
    </Suspense>
  },
  {
    path: '/layout',
    element: <Suspense fallback={<Loading/>}>
      <Layout/>
    </Suspense>,
    children: [
      {
        path: '/layout/honor',
        element: <Suspense fallback={<Loading/>}>
          <HonorRank/>
        </Suspense>,
      },
      {
        path: '/layout/honor/rule',
        element: <Suspense fallback={<Loading/>}>
          <HonorRankRule/>
        </Suspense>,
      },
      {
        path: '/layout/game-king-rank',
        element: <Suspense fallback={<Loading/>}>
          <GameKingRank/>
        </Suspense>
      },
      {
        path: '/layout/game-king-rank/rule',
        element: <Suspense fallback={<Loading/>}>
          <GameKingRankRule/>
        </Suspense>
      },
      {
        path: '/layout/game-king-rank/record',
        element: <Suspense fallback={<Loading/>}>
          <GameKingRankRecord/>
        </Suspense>
      },
      {
        path: '/layout/fans-group/intimate-record',
        element: <Suspense fallback={<Loading/>}>
          <IntimateRecord/>
        </Suspense>
      },
      {
        path: '/layout/fans-group/member-list',
        element: <Suspense fallback={<Loading/>}>
          <MemberList/>
        </Suspense>
      },
      {
        path: '/layout/mall',
        element: <Suspense fallback={<Loading/>}>
          <Mall/>
        </Suspense>
      },
      {
        path: '/layout/pk',
        element: <Suspense fallback={<Loading/>}>
          <PK/>
        </Suspense>
      },
      {
        path: '/layout/transition',
        element: <Suspense fallback={<Loading/>}>
          <Transition/>
        </Suspense>
      },
      {
        path: '/layout/mid-festival',
        element: <Suspense fallback={<Loading/>}>
          <MidFestival/>
        </Suspense>
      },
      {
        path: '/layout/mid-festival/rule',
        element: <Suspense fallback={<Loading/>}>
          <MidFestivalRule/>
        </Suspense>
      },
      {
        path: '/layout/mid-festival/task',
        element: <Suspense fallback={<Loading/>}>
          <MidFestivalTask/>
        </Suspense>
      },
      {
        path: '/layout/sign-up/open-box',
        element: <Suspense fallback={<Loading/>}>
          <SignUpOpenBox/>
        </Suspense>
      },
      {
        path: '/layout/sign-up/rule',
        element: <Suspense fallback={<Loading/>}>
          <SignUpRule/>
        </Suspense>
      },
      {
        path: '/layout/sign-up/center',
        element: <Suspense fallback={<Loading/>}>
          <SignUp/>
        </Suspense>
      },
      {
        path: '/layout/sign-up/task',
        element: <Suspense fallback={<Loading/>}>
          <SignUpTask/>
        </Suspense>
      },
    ],
  },
];

export default routes;
